DEFINITION MODULE FilePositions;

(*
*    Copyright (c) 1985,1986,1987,1988,1989 by
*    ana-systems, Foster City, California.
*    All Rights Reserved.
*
*    This software is furnished under a license and may be used and copied
*    only  in accordance with  the  terms  of  such  license and  with the
*    inclusion of the above copyright notice.  This software or  any other
*    copies thereof may not be provided or otherwise made available to any
*    other  person.   No title to and ownership of the  software is  herby
*    transferred.
*
*    The information in this software is  subject to change without notice
*    and  should  not be construed as a commitment by ana-systems.   No
*    warranty is implied or expressed.
*
*   SCCID  = "1.1    1/26/86"; 
*)
(* May be used for Text or Binary files, but mixed mode usage is very 
   non-portable *)

FROM Files IMPORT File, FileState, FilePosition;

EXPORT QUALIFIED
    GetFilePos,    SetFilePos,
    CalcFilePos,   GetEOF,           GetBOF;

PROCEDURE GetFilePos    (    file          : File;
                         VAR pos           : FilePosition);
(* returns the current position in the file *)

PROCEDURE GetEOF  (          file          : File;
                         VAR pos           : FilePosition);
(* returns a FilePosition of the current end of the file *)

PROCEDURE GetBOF  (          file          : File;
                         VAR pos           : FilePosition);
(* returns a FilePosition of the beginning of the file *)

PROCEDURE CalcFilePos (      file          : File;
                         VAR pos           : FilePosition;
                             numOfElements : INTEGER;
                             elementLength : CARDINAL);
(* ADDRESSINC); elementLength should be of this type .. fix it later. SRO *)
(* Calculate a file position relative to FilePos, offset by NumOfElements.
   Return the resulting position in FilePos *)
(* Note: A program which calls this procedure passing a file which was
   Opened/Created as textMode is probably not portable *)

PROCEDURE SetFilePos    (    file          : File;
                             pos           : FilePosition;
                         VAR state         : FileState);
(* positions the file as specified.  illegal position leaves the file
   as it was before the call and returns a bad state *)

END FilePositions.
(*
